<?php 
	session_start();
	if (isset($_SESSION['username']) && isset($_SESSION['uid'])) {
		require('../../Controller/MaintainSystem_controller.php');
		$admin = new MaintainSystem();
		$account = $_SESSION['username'];
		$uid = $_SESSION['uid'];
		if($admin->checkUser($account, $uid)) {
			
			//修改使用者頭像
			$id = $_POST["id"];
			$new_file = $_FILES["upfile"];
			$admin->profileEditPic($id, $new_file);
			header("location:./UserInfo.php");
		}else {
			header("location:../../login.php");
		}	
	}else {
		header("location:../../login.php");
	}
?>